package com.example.controller.shangPinCourseShenHeController;

import com.example.pojo.shangPinCourseShenHePojo.JsCourseRecord;
import com.example.pojo.shangPinDataPojo.ResultDate;
import com.example.service.shangPinCourseShenHeService.JsCourseRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Author:郭
 * @Description: TODO
 * @Date: 2022/12/7 14:09
 * @ClassName JsCourseRecordController
 * 商品+课程审核表
 */
@RequestMapping("/JsCourseRecord")
@Controller
public class JsCourseRecordController {
    @Autowired
    private JsCourseRecordService jsCourseRecordService;
    /**
     * @Author: 郭
     * @Date: 2022/12/7 14:11
     * @Param:
     * @Return:
     */
    @GetMapping("/getAll")
    @ResponseBody
    public ResultDate<JsCourseRecord> getAll(){
        List<JsCourseRecord> all = jsCourseRecordService.getAll();
        ResultDate<JsCourseRecord> date = new ResultDate<>();
        date.setCount(jsCourseRecordService.getCount());
        date.setData(all);
        System.out.println("商品+课程审核数据："+date);
        return date;
    }
    /**
     * @Author: 郭
     * @Date: 2022/12/22 13:29
     * @Param:
     *      launchId：发起人
     *      courseName：商品名称
     *      result：结果
     *      remarks：备注
     * @Return: List<JsCourseRecord>
     * 商品+课程审核表中的高级检索
     */
    @GetMapping("/auditProductQuery")
    @ResponseBody
    public List<JsCourseRecord> auditProductQuery(String launchId,
                                                  String courseName,
                                                  int result,
                                                  String remarks) {
        List<JsCourseRecord> jsCourseRecords = jsCourseRecordService.auditProductQuery(
                launchId,
                courseName,
                result,
                remarks);
        return jsCourseRecords;
    }
    /**
     * @Author: 郭
     * @Date: 2022/12/22 19:20
     * @Param:
     *      launchId：发起人
     *      courseName：商品名称
     *      result：结果
     *      remarks：备注
     * @Return: List<JsCourseRecord>
     * 商品+课程表中的模糊查询
     */

    @GetMapping("/dimSubmit")
    @ResponseBody
    public List<JsCourseRecord> dimSubmit(String launchId,
                                          String courseName,
                                          int result,
                                          String remarks){
        List<JsCourseRecord> jsCourseRecords = jsCourseRecordService.dimSubmit(
                launchId,
                courseName,
                result,
                remarks);
        return jsCourseRecords;
    }
}
